package com.es.servlet;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * 描述:
 * es-servlet-
 *
 * @author Derek
 * 创建时间：2022-04-21 9:59
 */
@WebServlet(urlPatterns = "/regServlet")
public class RegServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //获取
        ServletContext application = this.getServletContext();
        String encoding = application. getInitParameter("encoding");
        //
        req.setCharacterEncoding(encoding);
        String name = req.getParameter("name");
        resp.setContentType("text/html;charset=utf-8");
        PrintWriter out = resp.getWriter();
        out.println("<h3>恭喜'"+name+"'注册成功</h3>");
        out.flush();

    }
}
